package com.yuexun.beilunpatient.ui.satisfaction.model.impl;

import com.yuexun.beilunpatient.base.BaseEntity;
import com.yuexun.beilunpatient.ui.satisfaction.api.SatisfactionApi;
import com.yuexun.beilunpatient.ui.satisfaction.bean.SatisfactionAnswerDtlBean;
import com.yuexun.beilunpatient.ui.satisfaction.bean.SatisfactionDateBean;
import com.yuexun.beilunpatient.ui.satisfaction.bean.SatisfactionDtlBean;
import com.yuexun.beilunpatient.ui.satisfaction.bean.SatisfactionTypeBean;
import com.yuexun.beilunpatient.ui.satisfaction.bean.StartSatisfactionBean;
import com.yuexun.beilunpatient.ui.satisfaction.bean.TemplateBean;
import com.yuexun.beilunpatient.ui.satisfaction.bean.TemplateTypeBean;
import com.yuexun.beilunpatient.ui.satisfaction.model.ISatisfactionModel;
import com.yuexun.beilunpatient.utils.ApiUtil;

import java.util.Map;

import rx.Observable;

/**
 * Created by chenss on 2018/7/31 0031.
 */

public class SatisfactionModel implements ISatisfactionModel {

    private SatisfactionApi api;

    //记录Log
//    private final Logger log = ProUtil.getLogger(LoginModel.class);

    public SatisfactionApi ApiInstance() {
        if (api != null) {
            return api;
        } else {
            return ApiUtil.getInstance().createRetrofitApi(SatisfactionApi.class);
        }
    }

    @Override
    public Observable<BaseEntity<SatisfactionDateBean>> inquireUserSurveyPageList(Map<String, String> praise) {
        api = ApiInstance();
        return api.inquireUserSurveyPageList(praise);
    }

    @Override
    public Observable<BaseEntity<SatisfactionTypeBean>> getSatisfactionTypeList(Map<String, String> praise) {
        api = ApiInstance();
        return api.getSatisfactionTypeList(praise);
    }

    @Override
    public Observable<BaseEntity<StartSatisfactionBean>> startSatisfaction(Map<String, String> praise) {
        api = ApiInstance();
        return api.startSatisfaction(praise);
    }

    @Override
    public Observable<BaseEntity<SatisfactionAnswerDtlBean>> getSatisfactionAnswerDtl(Map<String, String> praise) {
        api = ApiInstance();
        return api.getSatisfactionAnswerDtl(praise);
    }

    @Override
    public Observable<BaseEntity<SatisfactionDtlBean>> getSatisfactionDtl(Map<String, String> praise) {
        api = ApiInstance();
        return api.getSatisfactionDtl(praise);
    }

    @Override
    public Observable<BaseEntity<String>> updateSatisfactionAnswer(Map<String, String> praise) {
        api = ApiInstance();
        return api.updateSatisfactionAnswer(praise);
    }

    @Override
    public Observable<BaseEntity<TemplateTypeBean>> inquireSatisfactionTemplateTypeList(Map<String, String> praise) {
        api = ApiInstance();
        return api.inquireSatisfactionTemplateTypeList(praise);
    }

    @Override
    public Observable<BaseEntity<TemplateBean>> inquireSatisfactionTemplateList(Map<String, String> praise) {
        api = ApiInstance();
        return api.inquireSatisfactionTemplateList(praise);
    }

    @Override
    public Observable<BaseEntity<String>> createSatisfactionByUser(Map<String, String> praise) {
        api = ApiInstance();
        return api.createSatisfactionByUser(praise);
    }
}
